package com.imy.luascript.app.ui.demo;

import android.content.Context;
import android.view.View;
import android.widget.TextView;

import com.imy.common.base.adapter.BaseSimpleListAdapter;
import com.imy.common.base.adapter.BaseViewHolder;
import com.imy.luascript.R;
import com.imy.luascript.mapping.DemoMapping;

import java.util.List;

import butterknife.BindView;

public class DemoListAdapter extends BaseSimpleListAdapter<String, DemoListAdapter.Holder> {

  public DemoListAdapter(Context context, List<String> infos) {
    super(context, infos);
  }

  @Override
  protected void bindView(int position, Holder holder, View convertView, String bean) {
    String title = bean.replace("demo_", "");
    String s = DemoMapping.mapping.get(title);

    holder.mTextView.setText(title+"("+s+")");

  }

  @Override
  protected int getLayoutId() {
    return R.layout.list_item_demo;
  }

  @Override
  public Holder getHolder(View view) {
    return new Holder(view);
  }

  public static class Holder extends BaseViewHolder {
    @BindView(R.id.list_item_demo_tv) TextView mTextView;

    public Holder(View itemView) {
      super(itemView);
    }
  }
}
